#*********************************************************************************
# ** 文件名称：sqoop_mysql_hdfs.sh
# ** 功能描述：通过sqoop把mysql数据导入hdfs
# ** 创建者：xiaoxu
# ** 修改日期：19-06-13
# ** 修改人：
# ** 修改内容:
#*********************************************************************************
#!/usr/bin/env bash
sqoop import \
         --connect 'jdbc:mysql://192.168.20.15:3306/shop?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull' \
         --username root \
         --password root \
         --table mmall_order -m -1 \
         --fields-terminated-by ',' \
         --target-dir '/user/hive/warehouse/bdm.db/mmall_order/day=2019-06-25' \
         --delete-target-dir

sqoop import \
     --connect 'jdbc:mysql://192.168.20.15:3306/shop?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull' \
     --username root \
     --password root \
     --table mmall_order_item -m -1 \
     --fields-terminated-by ',' \
     --target-dir '/user/hive/warehouse/bdm.db/mmall_order_item/day=2019-06-25' \
     --delete-target-dir

sqoop import \
     --connect 'jdbc:mysql://192.168.20.15:3306/shop?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull' \
     --username root \
     --password root \
     --table mmall_shipping -m -1 \
     --fields-terminated-by ',' \
     --target-dir '/user/hive/warehouse/bdm.db/mmall_shipping/day=2019-06-25' \
     --delete-target-dir